home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq21.zip / LOGON.SLT < prev    next >
Text File  |  1992-03-22  |  35KB  |  984 lines

  1. //-----------------------------------------------------------
  2. // LOGON.SL? Automatic logging into any BBS.
  3.  
  4. //-----------------------------------------------------------
  5. // Please look at the comments through the whole file, and modify to
  6. // suit your needs before you use it. Then recompile with CS LOGON.
  7. // Modify your dialing directory as follows: linked script should be
  8. // set to LOGON, and your password should be set to whatever it is.
  9. //-----------------------------------------------------------
  10.  
  11. // If you have suggestions for improving this script, please suggest
  12. // improvements to me via old-fashioned snail-mail to:
  13.  
  14. // Author:  Inge Vabekk
  15. //          Hamangskogen 108
  16. //          N-1300 SANDVIKA
  17. //          NORWAY
  18. //          tel. (472) 546 396
  19.  
  20. // Various variable strings.
  21.  
  22. str bbs_type [32]              // BBS type.
  23.    ,bbs_name [32]              // BBS name.
  24.    ,User     [32]              // Your own name.      
  25.    ,Suser    [32]              // Save user name.     
  26.    ,logfile  [32]              // Log file name.  
  27.    ,catfile  [32]              // Catalog file name.
  28.    ,shortname[ 8]              // BBS name,
  29.    ,codename [ 8]              // ID-code,
  30.    ,help     [80]              // For various help
  31.    ,lline    [60]              // Read last line.
  32.    ,input   [144]              // Input line (from file).
  33.    ,check     [4]              // For checking "short" globals.
  34.  
  35. // Script names.
  36.  
  37.    ,upload  [] = "UPLOAD"      // Name of upload script.
  38.    ,grabmail[] = "GRABMAIL"    // Name of GrabMail script.
  39.    ,getname [] = "GETNAME"     // Name of GetName script.
  40.    ,newfiles[] = "NEWFILES"    // Name of NewFiles script.
  41.    ,modscript[]= "MOD.SLC"     // Name of MOD script.
  42.    ,dnload  [] = "DNLOAD"      // Name of download script.
  43.    ,mailup  [] = "MAILUP"      // Name of mail upload script.
  44.    ,PutLine [] = "PUTLINE"     // Name of put line script.
  45.    ,ssl     [] = "SSL"         // Name of status line script.
  46.    ,global  [] = "GLOBAL"      // Global script
  47.    ,show    [] = "DISPLAY"     // Display logoff/exit status
  48.    ,conflist[] = "CONFLIST"    // Get conference list (MBBS only)
  49.    ,BBSHOOK[65]= " "           // Name of BBS hook script.
  50.  
  51. // Global variable names
  52.  
  53.    ,bbsname []="BNAME"         // BBS name.
  54.    ,cname   []="CNAME"         // Codename for current BBS
  55.    ,bbstype []="BTYPE"         // BBS type
  56.    ,mscript []="MDOOR"         // Mail script/door
  57.    ,short   []="SHORT"         // Shortened BBS name
  58.    ,conf    []="CONF"          // Current conference
  59.    ,username[]="NAME"          // User name
  60.    ,addr    []="ADDR"          // User's address
  61.    ,dpass   []="DPASS"         // Default password
  62.    ,passw   []="PASSW"         // Current password
  63.    ,graph   []="GRAPH"         // Graphics: YES or NO
  64.    ,cprot   []="CPROT"         // Current protocol
  65.    ,hprot   []="HPROT"         // "His" protocol
  66.    ,version []="BBSVER"        // BBS version
  67.    ,logoff  []="LOGOF"         // Auto-Logof setting
  68.    ,changed []="CHANGE"        // Status line changed
  69.    ,reader  []="READER"        // Offline reader in use
  70.    ,newmes  []="NEWMES"        // Directory of new messages
  71.    ,getnew  []="NEWFIL"        // New files wanted?
  72.    ,rmode   []="RMODE"         // Read mode
  73.    ,fixup   []="FIXUP"         // Fix setup (MBBS)
  74.    ,gconflst[]="CNFLST"        // Get conference list?
  75.    ;
  76.  
  77. int tol = 300            // No activity for 30 seconds
  78.    ,stat, tmark          // makes script time out. 
  79.    ,pcb=0                // 1 for PCBoard, 2 for ProLogon, otherwise 0.
  80.    ,mbbs=0               // TRUE for MBBS
  81.    ,rbbs=0               // TRUE for RBBS
  82.    ,opus=0               // TRUE for OPUS
  83.    ,atari=0              // TRUE for ATARI
  84.    ,crcs=0               // TRUE for CRCS
  85.    ,wildcat
  86.    ,BBSver               // BBS version no.
  87.    ,y                    // Y coordinate for writing on screen.
  88.    ,pw1, pw2             // Trig for password request
  89.    ,ppass                // =1 if BBS script should send password.
  90.    ,xboard = 0           // =1 if XBoard is being used
  91.    ,Enter = 13           // Code for Enter.
  92.    ;
  93.  
  94. //-----------------------------------------------------------
  95. // Script starts here.
  96. //-----------------------------------------------------------
  97.                                
  98. main()
  99. {
  100. int c, error, i, l, na, t1, t2, lf, lfs;
  101. int pcb1, pcb2                         // Trigs for various PCBs
  102.    ,mbbs1                              // trig for MBBS 9.9 and above
  103.    ,opus1, atar1, crcs1                // trig for OPUS/Atari/crcs
  104.    ,wild1                              // trig for WildCat!
  105.    ,esc
  106.    ,more
  107.    ,WantGrab
  108.    ;
  109.  
  110. // Only if online.
  111.  
  112.   entry();
  113.   keyset (0x1000,0,"@Logoff");         // Set the Alt-Q key.
  114.   i = 0;
  115.   while (!carrier())
  116.   { delay(1);
  117.     if (++i > 10)
  118.     if (!carrier())
  119.     { failtone();
  120.       release();
  121.       status_wind ("T²: THE LOGON SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
  122.       return (-1);
  123.     }
  124.   }
  125.   ppass = 1;                           // Send password is default.
  126.   clear_scr();
  127.  
  128. // Only if the Global script is loaded.
  129. //-----------------------------------------------------------
  130.  
  131.   if (!is_loaded(global))              // If Global script is not
  132.   { box (13,7,62,14,176,1,15);
  133.     box (15,8,60,13,177,1,15);
  134.     box (17,9,58,12,178,1,15);
  135.     pstraxy ("  Sorry - the LOGON script only works   ",18,10,79);
  136.     pstraxy (" if you execute the Qdial script first! ",18,11,79);
  137.     gotoxy (0,20);
  138.     failtone();
  139.     goto end2;
  140.   }
  141.  
  142. // Start all tracking at once - just in case something takes long.
  143.  
  144.   pcb1  = track ("nter Lang",0);       // Check for PCboard / ProLogon
  145.   pcb2  = track (" graphics",0); 
  146.   esc   = track ("ss Escape",0);       // Press Escape?
  147.   mbbs1 = track (") MBBS",0);          // Check for MBBS
  148.   opus1 = track ("OPUS",0);            // Check for OPUS BBS
  149.   atar1 = track ("Atari ST",0);        // Check for Atari MiniBBS
  150.   wild1 = track ("[N]onStop? [",0);    // Check for WildCat!
  151.   crcs1 = track ("CRCS system ",0);    // Check for CRCS
  152.   more = track ("--more--",0);         // Check for the "more" prompt
  153.   na = track (" your first na", 1);    // Request for name.
  154.   lf = track ("^J", 0);                // Track linefeed.
  155.   lfs = 0;
  156.  
  157.   if (!strlen(Suser))
  158.     read (Username,Suser);             // Get user name from NAME.DAT.
  159.  
  160.   bbs_name = _entry_name;
  161.   i = strposi (bbs_name,"D:",0);       // Find "D:" in string.
  162.   if (i < 0) 
  163.     i = strlen (bbs_name);             // Not found: Use length.
  164.  
  165.   for (--i; i>1; --i) 
  166.     if (subchr (bbs_name,i)!=' ') break; // Delete trailing spaces.
  167.   setchr (bbs_name,i+1,0);             // This is last character.   
  168.  
  169. // Extract the first 8 alphabetic characters
  170. // to get the short name.
  171.  
  172.   c = 0;
  173.   error=strlen (bbs_name);
  174.   for (i=0; (error=subchr (bbs_name,i)) > 0; ++i) 
  175.   { if (isalpha(error=toupper(error))) 
  176.     { setchr (shortname,c,error);
  177.       ++c;
  178.       if (c > 7) break;
  179.     }
  180.   }
  181.   setchr (shortname,c,0);              // End string.
  182.   write (short,shortname);             // Enter short name into global.
  183.   logfile = "LOG\";                    // Logfile directory.
  184.   strcat (logfile,shortname);
  185.  
  186.   stat = capture_stat();               // Check capture file status.
  187.  
  188.   if (stat) 
  189.     capture ("*CLOSE*");
  190.  
  191.   entry ();                            // Update colors & status bar. 
  192.   y = 1;
  193.   display (bbs_name,0,12);             // Write it on the screen.
  194.   i = strlen (bbs_name);
  195.   y = display (" answered. ",i,12);
  196.   y = display("Opening log file... ",0,15);
  197.   fdelete (logfile);                   // Delete previous file.
  198.   if(capture(logfile) < 0)
  199.     y = display("LOG FILE NOT OPENED! ",0,15);
  200.   else
  201.   { i = display ("Capturing into ",0,15);
  202.     y = display (_capture_fname,15,62); 
  203.   }
  204.  
  205.   write (bbsname,bbs_name);            // Write BBS name to global.
  206.   i = call (ssl);                      // Find status line.         
  207.   terminal();
  208.   pstraxy ("                           ",0,i,116);
  209.   pstraxy (bbs_name,1,i,116);          // Write BBS name on status line.  
  210.   goto